<?php

interface Adapter
{
    public function request($param);
}

class AjaxAdapter implements Adapter
{
    public function request($param)
    {

    }
}

class NodeAdapter implements Adapter
{
    public function request($param)
    {

    }
}

/**
 * 【开闭原则】
 * 对扩展开放，对修改关闭
 * 通过继承接口Adapter实现更多的功能，不对已有的功能做出修改
 * Class HttpRequester
 */
class HttpRequester
{
    private $adapter;

    public function __construct(Adapter $adapter)
    {
        $this->adapter = $adapter;
    }

    public function fetch($param)
    {
        return $this->adapter->request($param);
    }
}
